#include "modelstatusmanager.h"
#include "logger.h"
void ModelStatusManager::setCameraStatus(CameraEth0::CameraStatus status) {
    std::lock_guard<std::mutex> lock(cameraMutex);
    if (m_cameraStatus != status) {
        m_cameraStatus = status;
        LogInfo << "setCameraStatus : " <<  status;
        cameraCondition_.notify_all();  // 通知所有等待的线程
    }
}

void ModelStatusManager::waitForCameraRunning() {
    if(m_cameraStatus != CameraEth0::Running)
    {
        std::unique_lock<std::mutex> lock(cameraMutex);
        cameraCondition_.wait(lock, [this] { return m_cameraStatus == CameraEth0::Running; });
    }
}
